<?php
/**
 * Created by littleU.
 * User: littleU
 * Date: 2021-01-29
 * Time: 13:44
 */

namespace app\api\model;


class ProductSku extends BaseModel
{
    public function image()
    {
        return $this->hasOne('productSkuImage','sku_id','id');
    }

    public function skuSales()
    {
        return $this->hasOne('productSalesVolume','sku_code','sku_code')->bind(['sku_sales_volume' => 'sales_volume']);
    }

    public function stock()
    {
        return $this->hasOne('productSkuStock','sku_code','sku_code')->where('stock_status',1)->bind(['sku_stock'=>'salable_qty']);
    }
}